package com.dqhl.business.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.dqhl.business.fragment.GoodsManagerCloseFragment;
import com.dqhl.business.fragment.GoodsManagerOpenFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by guanluocang on 2016/11/9.
 */
public class GoodsManagerPageAdapter extends FragmentPagerAdapter {

    private List<Fragment> mFragments;

    public GoodsManagerPageAdapter(FragmentManager fm){
        super(fm);
        initFragment();
    }
    /**
     * 实例两个fragment
     */
    private void initFragment() {
        mFragments=new ArrayList<>();
        mFragments.add(new GoodsManagerOpenFragment());
        mFragments.add(new GoodsManagerCloseFragment());
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

}
